import Vue from "vue";
import VueRouter from "vue-router";

//按需加载路由（路由懒加载）
const Home = () => import("../pages/Home");
const MusicPlayer = () => import("../pages/MusicPlayer");
const ListenBook = () => import("../pages/ListenBook");
const PlayList = () => import("../pages/PlayList");
const Radio = () => import("../pages/Radio");
const Search = () => import("../pages/Search");
const Mv = () => import("../pages/MV/Mv.vue");
const Ranking = () => import("../pages/Ranking");
const MvPlayer = () => import("../pages/MvPlayer/MvPlayer.vue");
const Login = () => import("../pages/Login");

Vue.use(VueRouter);

const routes = [
	{
		name: "Home",
		path: "/",
		component: Home
	},
	{
		name: "PlayList",
		path: "/playlist",
		component: PlayList
	},
	{
		name: "Radio",
		path: "/radio",
		component: Radio
	},
	{
		name: "Search",
		path: "/search",
		component: Search
	},
	{
		name: "Ranking",
		path: "/ranking",
		component: Ranking
	},
	{
		name: "MusicPlayer",
		path: "/musicplayer",
		component: MusicPlayer,
		meta: {
			isFooterHide: true
		}
	},
	{
		name: "PlayList",
		path: "/playlist",
		component: PlayList
	},
	{
		name: "listenBook",
		path: "/ListenBook",
		component: ListenBook
	},
	{
		name: "Radio",
		path: "/radio",
		component: Radio
	},
	{
		name: "Search",
		path: "/search",
		component: Search
	},
	{
		name: "Ranking",
		path: "/ranking",
		component: Ranking
	},
	{
		name: "Mv", // 命名路由
		path: "/mv",
		component: Mv
	},
	{
		name: "MvPlayer", // 命名路由
		path: "/mvweb",
		component: MvPlayer
	},
	{
		name: "Login",
		path: "/login",
		component: Login,
		meta: {
			isFooterHide: true,
			isHeaderHide: true
		}
	}
];

const router = new VueRouter({
	mode: "history",
	routes,
	// 滚动行为
	// 当路由切换时，控制滚动条的行为（位置）
	scrollBehavior() {
		return { x: 0, y: 0 };
	}
});
export default router;
